package com.edu.medicalpro.intercepter;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;

public class AddTokenInterceptor  implements Interceptor {

    @Override
    public Response intercept(Chain chain) throws IOException {
        Request request=chain.request();
        String token=Constant.TOKEN;
        if(token!=null){
            Request request1=request.newBuilder()
                    .addHeader("token",token)
                    .build();
            return chain.proceed(request1);
        }
        return chain.proceed(request);
    }
}
